package com.dingding.dao.systemdao.impl;

import java.util.List;

import com.dingding.bean.databean.response.ResGetBanner;
import com.dingding.bean.entity.Banner;
import com.dingding.common.core.util.ToolUtil;
import com.dingding.dao.basedao.impl.BaseDaoImpl;
import com.dingding.dao.systemdao.IBannerDao;

public class BannerDaoImpl extends BaseDaoImpl<Banner> implements IBannerDao {
	/**
	 * @Title: setResGetBannerList
	 * @Description: 设置响应bean
	 * @param bannerList
	 *            数据库查询到的数据封装
	 * @param resGetBanners
	 *            返回的响应信息封装bean
	 * @author zhaochenguang
	 * @return void
	 * @throws
	 */

	public boolean setResGetBannerList(List<Banner> bannerList,
			List<ResGetBanner> resGetBanners) {
		if (bannerList != null) {
			for (Banner banner : bannerList) {
				ResGetBanner resGetBanner = new ResGetBanner();
				if (banner.getBnnerImage() != null) {
					// 设置Banner的图像
					resGetBanner.setPropagandaImage(ToolUtil.imageAddress(banner.getBnnerImage()));
				}
				if (banner.getBnnerContent() != null) {
					// 设置内容(Html)
					resGetBanner.setContent(banner.getBnnerContent());
				}
				if (banner.getCreateTime() != null) {
					// 设置时间
					resGetBanner.setCreateTime(banner.getCreateTime());
				}
				resGetBanners.add(resGetBanner);
				return true;

			}

		}
		return false;
	}

}
